package com.demo.study.thread.JUC;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @author leiliang
 * @version 1.0
 * @Description
 * @date 2021/1/14 16:30
 */
public class Thread1 extends Thread {

    public static volatile boolean flag = true;


    @Override
    public void run() {
         while (flag){
         }
    }

    public static void main(String[] args) {
        ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
        concurrentHashMap.put("a","a");
        concurrentHashMap.get("a");
        new Thread1().start();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        flag = false;
        System.out.println(Thread.currentThread().getName()+"主线程已停止");
    }
}
